﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TV_Organizer
{
    public class Language : IComparable
    {
        #region static

        private static readonly Language _unknown = new Language("Unknown", "");
        private static readonly Language _english = new Language("English", "en");
        private static readonly Language _french = new Language("Français", "fr");
        private static readonly Language _all = new Language("All", "");

        public static Language English { get { return _english; } }
        public static Language French { get { return _french; } }
        public static Language Unknown { get { return _unknown; } }
        public static Language All { get { return _all; } }

        private static readonly Language[] _languages = new Language[]
        {
            English,
            French,
        };
        public static IEnumerable<Language> ValidLanguages { get { return _languages; } }

        #endregion

        public Language(string longName, string shortName)
        {
            this.LongName = longName;
            this.ShortName = shortName;
        }

        public string LongName { get; private set; }
        public string ShortName { get; private set; }

        public override string ToString()
        {
            return this.LongName;
        }

        public int CompareTo(object obj)
        {
            if (obj is Language)
                return this.ToString().CompareTo(((Language)obj).ToString());

            return 0;
        }
    }
}
